package com.roc.service.impl;

import java.util.Iterator;
import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.roc.dao.DaoException;
import com.roc.dao.IBaseDao;
import com.roc.dao.cardBin.ICardBinDao;
import com.roc.pojo.EtbSysCardBinno;
import com.roc.service.ServiceException;
import com.roc.service.cardBin.ICardBinService;
import com.roc.util.Constance;
@Service
@Transactional
public class CardBinServiceImpl implements ICardBinService{
	static Logger logger=Logger.getLogger(CardBinServiceImpl.class);
	@Autowired
	private IBaseDao baseDao;
	@Autowired
	private ICardBinDao cardBinDao;
	@Override
	public void deleteCardBin(String cardBin, long cardLen)
			throws ServiceException {
		// TODO Auto-generated method stub
		try{
			cardBinDao.deleteCardBin(cardBin, cardLen);
		}catch(DaoException e){
			logger.debug(e.getMessage(), e);
			throw new ServiceException("删除失败");
		}
	}
	@Override
	public void updateCardBin(EtbSysCardBinno card,String cardBin,Long cardLen) throws ServiceException {
		// TODO Auto-generated method stub
		try{
			cardBinDao.updateCardBin(card,cardBin,cardLen);
		}catch(DaoException e){
			logger.debug(e.getMessage(), e);
			throw new ServiceException("更新失败");
		}
	}
	@Override
	public void addCardBin(EtbSysCardBinno card) throws ServiceException {
		// TODO Auto-generated method stub
		try{
			cardBinDao.addCardBin(card);
		}catch(DaoException e){
			logger.debug(e.getMessage(), e);
			throw new ServiceException("新添失败");
		}
	}
	@Override
	public EtbSysCardBinno queryCardBin(String cardBin, long cardLen)
			throws ServiceException {
		// TODO Auto-generated method stub
		EtbSysCardBinno card=null;
		try{
		card=cardBinDao.queryCardBin(cardBin, cardLen);
			
		}catch(DaoException e){
			logger.debug(e.getMessage(), e);
			throw new ServiceException("查询失败");
		}
		return card;
	}
}
